﻿using System;

using WebDavProcessor.Constants;

namespace WebDavProcessor.Methods
{
    public class WebDavException : Exception
    {
        private int exceptionCode;

        public int StatusCode { get { return exceptionCode; } }

        public WebDavException(int statusCode)
            : base(WebDavStatusDescriptions.GetDescription(statusCode))
        {
            if (statusCode >= 400 && statusCode < 600)
            {
                exceptionCode = statusCode;
            }
            else
            {
                exceptionCode = WebDavStatusCodes.InternalServerError;
            }
        }

        public override string Message
        {
            get
            {
                return base.Message;
            }
        }
    }
}
